//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

package finaltask;

import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;
import inet.nodes.inet.Router;
import inet.nodes.inet.StandardHost;
import inet.nodes.inet.WirelessHost;
import inet.nodes.wireless.AccessPoint;
import inet.world.radio.ChannelControl;
import ned.DatarateChannel;
import inet.applications.udpapp.UDPBasicApp;
import inet.nodes.ethernet.Eth100M;
//import inet.nodes.ethernet.router;

//
// TODO documentation
//
simple VoIPApp extends UDPBasicApp
{
    @class(VoIPApp); // this means that we want to use our VoIPApp C++ class,
}
network Network
{
    parameters:
        int RateCh @unit(Mbps);
        int numUsers;
    @display("bgb=559,228");
    types:
        channel RouterToISP_Router extends DatarateChannel
        {
            delay = 15ms;
            datarate = RateCh;	//8Mbps or 20 Mbps
        }

        channel ISP_RouterToInternet extends DatarateChannel
        {
            delay = 30ms;
            datarate = 1Gbps;
        }

    submodules:
        AccessPoint: AccessPoint {
            @display("p=173,105");
        }
        Router: Router {
            @display("p=267,108");
        }
        WebServer: StandardHost {
            @display("p=498,106");
        }
        WebUsers[numUsers]: WirelessHost {
            @display("p=54,106");
        }

        VOIPUser: WirelessHost {
            @display("p=54,46");
        }
        FTPUser: WirelessHost {
            @display("p=54,173");
        }
        channelControl: ChannelControl {
            @display("p=382,30");
        }
        iPv4NetworkConfigurator: IPv4NetworkConfigurator {
            @display("p=259,31");
        }
        VOIPServer: StandardHost {
            @display("p=503,170");
        }
        FTPServer: StandardHost {
            @display("p=503,31");
        }
        ISP_Router: Router {
            @display("p=392,108");
        }
    connections:
        Router.pppg++ <--> RouterToISP_Router <--> ISP_Router.pppg++;
        AccessPoint.ethg++ <--> Eth100M <--> Router.ethg++;
        ISP_Router.pppg++ <--> ISP_RouterToInternet <--> WebServer.pppg++;
        ISP_Router.pppg++ <--> ISP_RouterToInternet <--> FTPServer.pppg++;
        ISP_Router.pppg++ <--> ISP_RouterToInternet <--> VOIPServer.pppg++;
}

